package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.TourismPlan;
import com.xx.pmis.persistence.dao.TourismPlanDAO;
import com.xx.pmis.services.TourismPlanService;

public class TourismPlanServiceImpl implements TourismPlanService {
	TourismPlanDAO tourismPlanDAO = null;

	public TourismPlanServiceImpl(TourismPlanDAO tourismPlanDAO) {
		super();
		this.tourismPlanDAO = tourismPlanDAO;
	}

	public void saveOrUpdateTourismPlan(TourismPlan tourismPlan) throws Exception {
		tourismPlanDAO.saveOrUpdate(tourismPlan);
	}

	public void saveTourismPlan(TourismPlan tourismPlan) throws Exception {
		tourismPlanDAO.save(tourismPlan);
	}

	public void deleteTourismPlan(TourismPlan tourismPlan) throws Exception {
		tourismPlanDAO.delete(tourismPlan);
	}

	public TourismPlan getTourismPlanByTourismPlanID(String tpID) throws Exception {
		TourismPlan TourismPlan = tourismPlanDAO.getTourismPlanByTourismPlanID(tpID);
		return TourismPlan;
	}

	public List<TourismPlan> getAllTourismPlanByCondition(String sql) throws Exception {
		List<TourismPlan> tourismPlans = tourismPlanDAO.getAllTourismPlanByCondition(sql);
		return tourismPlans;
	}

	public List<TourismPlan> getAllTourismPlanByConditionByPage(String sql, int currentPage, int lineSize) throws Exception {
		List<TourismPlan> tourismPlans = tourismPlanDAO.getAllTourismPlanByConditionByPage(sql, currentPage, lineSize);
		return tourismPlans;
	}

	public int getCountOfTourismPlanByCondition(String sql) throws Exception {
		return tourismPlanDAO.getAllTourismPlanByCondition(sql).size();
	}


}
